<!DOCTYPE html>
<html lang="zh-CN"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>新零售微店后台首页</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link th:href="@{/layui/css/layui.css}"  rel="stylesheet">
    <link th:href="@{/style/admin.css}"  rel="stylesheet">
    <style>
        .layui-table{overflow-y: scroll;}
    </style>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <form name="form" class="form">
                        <label class="layui-form-label"></label>
                        <div class="layui-input-block">
                            <div class="layui-input-inline">
                                <select name="orderStatus" id="orderStatus"  lay-verify="required"   lay-filter="select1">
                                    <option selected="selected" value="0">订单状态</option>
                                    <option value="701">待付款</option>
                                    <option value="702">待发货</option>
                                    <option value="703">待收货</option>
                                    <option value="704">已完成</option>
                                    <option value="706">已取消</option>
                                    <option value="707">已退款</option>
                                </select>
                            </div>
                            <!--<div class="layui-input-inline">-->
                                <!--<select name="payStatus" id="payStatus" lay-filter="select2">-->
                                    <!--<option selected="selected"  value="0">支付状态</option>-->
                                    <!--<option value="801">待支付</option>-->
                                    <!--<option value="802">已支付</option>-->
                                <!--</select>-->
                            <!--</div>-->
                            <!--<div class="layui-input-inline" >-->
                                <!--<select name="deliveStatus" id="deliveStatus" lay-filter="select3">-->
                                    <!--<option selected="selected"  value="0">发货状态</option>-->
                                    <!--<option value="901">已发货</option>-->
                                    <!--<option value="902">待发货</option>-->
                                <!--</select>-->
                            <!--</div>-->
                        </div>
                    </form>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">订单号</label>
                    <div class="layui-input-block">
                        <input type="text" name="keywords" id="keywords" placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">会员编号</label>
                    <div class="layui-input-block">
                        <input type="text" name="keywords" id="userNo" placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-user-back-search" onclick="SelectData()">
                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                    </button>
                    <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-user-back-search" onclick="qingkong()">
                        <i class="layuiadmin-button-btn">清空条件</i>
                    </button>
                </div>
            </div>
        </div>

        <div class="layui-card-body">
            <div style="padding-bottom: 10px;">

                <!--<button class="layui-btn layuiadmin-btn-admin" data-type="batchdel">删除</button>-->
                <!--<button class="layui-btn layuiadmin-btn-admin" data-type="add" onclick="WinOpenAdd();">添加</button>-->
            </div>
            <!--<div style="padding-bottom: 10px;">-->
                <!--<button class="layui-btn layuiadmin-btn-admin" data-type="batchdel" value="701">待付款</button>-->
                <!--<button class="layui-btn layuiadmin-btn-admin" data-type="batchdel" value="702">待发货</button>-->
                <!--<button class="layui-btn layuiadmin-btn-admin" data-type="batchdel" value="703">待收货</button>-->
                <!--<button class="layui-btn layuiadmin-btn-admin" data-type="batchdel" value="704">已完成</button>-->
                <!--<button class="layui-btn layuiadmin-btn-admin" data-type="batchdel" value="706">已取消</button>-->
                <!--&lt;!&ndash;<button class="layui-btn layuiadmin-btn-admin" data-type="add" onclick="WinOpenAdd();">添加</button>&ndash;&gt;-->
            <!--</div>-->
            <table class="layui-table" lay-data="{url:'/getOrderList', id:'test3',page: true,limit:10,id: 'testReload'}" lay-filter="test3">
                <thead>
                <tr>
                    <th lay-data="{type:'numbers'}">序号</th>
                    <th lay-data="{type:'checkbox'}">ID</th>
                    <th lay-data="{field:'orderNo', width:195}">订单编号</th>
                    <th lay-data="{field:'userNo', width:120}">用户编号</th>
                    <th lay-data="{field:'name', width:120}">用户姓名</th>
                    <th lay-data="{field:'phone', width:120}">电话</th>
                    <th lay-data="{field:'addressAll', width:220}">地址</th>
                    <th lay-data="{field:'logName', width:120}">收货人姓名</th>
                    <th lay-data="{field:'pOrderTime',width:180,templet :function (row){return createTime(row.pOrderTime);}}">下单时间</th>
                    <th lay-data="{field:'orderMoney',minWidth: 90}">订单金额</th>
                    <th lay-data="{field:'orderStatus',minWidth: 90,templet :function (row1){return stateName(row1.orderStatus);}}">订单状态</th>
                    <!--<th lay-data="{field:'freight',minWidth: 90}">运费</th>-->
                    <th lay-data="{field:'realPay',minWidth: 90,templet :function (row1){return all(row1.realPay,row1.freight);}}">实际支付</th>
                    <!--<th lay-data="{field:'logisticalType',minWidth: 90,templet :function (row2){return logName(row2.logisticalType);}}">物流类型</th>-->
                    <th lay-data="{fixed: 'right', width:105, align:'center', toolbar: '#barDemo'}">操作</th>
                </tr>

                </thead>
            </table>
            <!--<table class="layui-hide" id="address"></table>-->

            <script type="text/html" id="barDemo">
                <!--href="/getOrderDetails?No={{d.orderNo}}&userId={{d.userId}}"-->
                <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail" data1="{{d.orderNo}}" data2="{{d.userId}}" onclick="query(this)" >查看</a>
                <!--<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>-->
            </script>

        </div>
    </div>
</div>

<script th:src="@{/layui/jquery.min.js}"></script>
<script th:src="@{/layui/layui.js}"></script>
<script th:src="@{/js/order.js}"></script>
<script th:inline="javascript">
   function query(obj){
       var a1=$(obj).attr("data1");
       var a2=$(obj).attr("data2");
       var url="/getOrderDetails?No="+a1+"&userId="+a2+"";
       var index = layer.open({
           type: 2,
           content: url,
           area: ['300px', '195px'],
           title: " ",
           maxmin: true
       });
       layer.full(index);
   }
    function all(a,b) {
        return parseFloat(a)+parseFloat(b);
    }
    function logName(type) {
        if(type==2){
            return"快递";
        }else {
            return"自提";
        }
    }
function stateName(st) {
    if(st==701){
        return "待付款";
    }
    if(st==702){
        return "待发货";
    }
    if(st==703){
        return "待收货";
    }
    if(st==704){
        return "已完成";
    }
    if(st==706){
        return "已取消";
    }
    if(st==707){
        return "已退款";
    }
}
    var ststus1=0;
    var ststus2=0;
    var ststus3=0;
    var keywords="";
    var userNo="";
    var form;
    layui.use('form', function () {
        form = layui.form;
        form.on('select(select1)', function (data) {
            ststus1 = data.value;
            keywords = $("#keywords").val();
            userNo=$("#userNo").val();
            selectAll(ststus1, ststus2, ststus3, keywords,userNo);
        });
        form.render();

        form.on('select(select2)', function (data) {
            ststus2 = data.value;
            keywords = $("#keywords").val();
            userNo=$("#userNo").val();
            selectAll(ststus1, ststus2, ststus3, keywords,userNo);
        });
        form.render();

        form.on('select(select3)', function (data) {
            ststus3 = data.value;
            keywords = $("#keywords").val();
            userNo=$("#userNo").val();
            selectAll(ststus1, ststus2, ststus3, keywords,userNo);
        });
        form.render();
    });
    function selectAll(status1,status2,status3,keywords,userNo) {
        //alert(status1+"--"+status2+"--"+status3+"--"+keywords);
        //执行重载
        table.reload('testReload', {
            url:"/selectOrderList?orderStatus="+status1+"&payStatus="+status2+"&deliveStatus="+status3+"&keywords="+keywords+"&userNo="+userNo,
            page: {
                curr: 1
            }
        });
    }
function qingkong() {
    $("#keywords").val("");
    $("#userNo").val("");
}
    function SelectData() {
        keywords = $("#keywords").val();
        userNo=$("#userNo").val();
        layui.use('form', function () {
            form = layui.form;
            form.on('select(select1)', function (data) {
                ststus1 = data.value;
                selectAll(ststus1, ststus2, ststus3, keywords,userNo);
            });
            form.render();

            form.on('select(select2)', function (data) {
                ststus2 = data.value;
                selectAll(ststus1, ststus2, ststus3, keywords,userNo);
            });
            form.render();

            form.on('select(select3)', function (data) {
                ststus3 = data.value;
                selectAll(ststus1, ststus2, ststus3, keywords,userNo);
            });
            selectAll(ststus1, ststus2, ststus3, keywords,userNo);
            form.render();

        });
    }
</script>
</body>
</html>

